import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
    state: (): IUserState => ({
        // 放一个用于存用户的权限的数组
        routesList: [],
        userName: ''
    }),
    actions: {
        clear() {
            this.routesList = [];
            this.userName = ''
        }
    },
    getters: {
        permissions(): string[] {
            return this.routesList.map(item => item.name)
        }
    }
})